/*
package com.magist.manage.common;

import com.jeesuite.filesystem.FSProvider;
import com.jeesuite.filesystem.FileSystemClient;
import com.jeesuite.filesystem.UploadObject;
import com.magist.core.entity.ResultMessage;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

*/
/**
 * 图片上传处理
 *
 *//*

@Api(value="文件上传",tags={"文件上传接口"})
@RestController
@RequestMapping("rest/upload")
public class UploadImgController {


	FSProvider provider = FileSystemClient.getClient("kada").getProvider();


	@PostMapping("doUploadFile.do")
	public ResultMessage uploadImg(@RequestParam(value="file") MultipartFile file) {
		String url;
		try {
			String fileNmae = this.getFileName(file.getOriginalFilename());
			UploadObject uploadObject = new UploadObject(fileNmae, file.getBytes());
			url = provider.upload(uploadObject);
			return ResultMessage.success("上传成功!",url);
		} catch (IOException e) {
			return ResultMessage.error("上传失败!",e.getMessage());
		}
	}

	private String getFileName(String fileName) {
		Date currentTime = new Date();
		SimpleDateFormat formatter = new SimpleDateFormat("yyMM");
		String filename = formatter.format(currentTime);
		filename = filename + "/" + UUID.randomUUID().toString();
		String ext = fileName;
		ext = ext.substring(ext.lastIndexOf(".") + 1);
		filename = filename + "." + ext;
		return filename;
	}

}
*/
